package com.modules.main2;

import com.base.mvvm2.BasePresenterImpl2;
import com.face.gaoml.netlibrary.data.rusult.BaseSubscriber;
import com.face.gaoml.netlibrary.data.rusult.HttpResultFunc;
import com.modules.bean.User;

import javax.inject.Inject;

/**
 * Created by gml on 17/1/6.
 */

public class UserViewModle extends BasePresenterImpl2 {



    public User mUser =new User();

    @Inject  //1 构造函数 提供支援 提供对象     2.注入构造器所需要的参数的依赖 （ 注入传递）
    public UserViewModle() {
    }


    public void login(String name, String pass) {
        mRxManager.addSubscription(
                apiStores.login("86", name, pass)
                        .map(new HttpResultFunc<User>()),
                new BaseSubscriber<User>() {
                    @Override
                    public void onNext(User result) {
                        if (result != null) {
                            getmUser().setUsername(result.getUsername());
                        }
                    }
                }

        );
    }

    public User getmUser() {
        return mUser;
    }

    public void setmUser(User mUser) {
        this.mUser = mUser;
    }



}
